actionPerformed()
actionPerformed()
The parameter for actionPerformed()
is a reference to an ActionEvent object.
When the button is clicked,
the method is called with a new action object parameter.
So far,
we've not used the
ActionEvent object.
We will do this shortly.
Here is the picture:
Usually the registered ActionListener is the object
that contains the button.
Usually this is an object
of a type that is a subclass of JFrame.
(In other words, you define a class based
on JFrame.
The class contains the button
and also implements the ActionListener interface.)
Could a frame hold two buttons?